﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DTBuilderLib.VisualHierarchyClasses;
using DTBuilderLib;
using System.IO;
using System.Drawing;
using DeepTalkWF;

namespace DeepTalkWFTest
{
    /// <summary>
    /// Summary description for CheckForDZToken
    /// </summary>
    [TestClass]
    public class t_CheckForDZToken
    {
        public t_CheckForDZToken()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void TestCheckDZToken()
        {
            Assert.Fail("Test not rewritten yet");
#if false
            VisualBitmapImage bm = new VisualBitmapImage(11.0F, 8.5F, 100, Color.Red);

            DeepZoomBuilder bld = new DeepZoomBuilder();
            DirectoryInfo bldDir = new DirectoryInfo(".\\TestOnePageRender");
            bld.BuildDirectory = bldDir.FullName;
            string talkName = "TestOnePageRender";
            var spec = bld.RenderVisualToCommand(talkName, bm);

            ///
            /// Make sure there is no token yet!
            /// 

            var r1 = Utilities.RunWFByType(typeof(CheckForDZToken), new Dictionary<string, object> { { "DZDirectory", bldDir }, { "MeetingName", talkName } });
            Assert.IsNotNull(r1, "The WF didn't complete");
            Assert.IsTrue(r1.ContainsKey("DZTokenStatus"), "The result was not part of the WF!");
            Assert.IsTrue(((bool)r1["DZTokenStatus"]) == false, "The status was not false!");

            bld.SetToken(talkName);

            var r2 = Utilities.RunWFByType(typeof(CheckForDZToken), new Dictionary<string, object> { { "DZDirectory", bldDir }, { "MeetingName", talkName } });
            Assert.IsNotNull(r2, "The WF didn't complete");
            Assert.IsTrue(r2.ContainsKey("DZTokenStatus"), "The result was not part of the WF!");
            Assert.IsTrue(((bool)r2["DZTokenStatus"]) == true, "The status was not true!");
#endif
        }
    }
}
